<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="renderer" content="webkit">
<meta name="msapplication-tap-highlight" content="no" /><!-- winphone 点击无高光 -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title>lightswiper演示</title>
<script src="https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js" type="text/javascript"></script>
<script>window.jQuery || document.write('<script src="http://s0.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"><\/script>')
</script>
<script>window.jQuery ||  document.write('<script src="js/jquery-3.3.1.min.js"><\/script>')</script>
<link rel="stylesheet" type="text/css" href="style.css?v=1" />
<script src="lightswiper.js"></script>
</head>
<body>
<style>
*{margin:0;padding:0;}
body{background-color:#f0f0f0;}

/*lightSwiper https://github.com/SimonZhangITer/light-swiper*/
.mon-light-swiper{overflow: hidden;position: relative;}
.mon-swiper-wrap{overflow: hidden;position: relative;}
.mon-swipe-item{float: left;width: 100%;position: relative;background-color:rgba(12,123,212,0.5)}

.mon-dot-wrap{display: flex;align-items: center;justify-content: center;position: absolute;bottom: 0;left: 50%;transform: translateX(-50%);z-index:9;}
.mon-dot{display: block;}
.mon-dot span{border-radius: 10px;display: inline-block;width: 5px;height: 5px;background:#fff;margin: 0 5px 0 5px;}
.mon-dot span.mon-activeswiper{background: #ff6e3f;}
</style>
    <div class="mon-light-swiper" id="mon_light_swiper">
        <div class="mon-swiper-wrap">
            <div class="mon-swipe-item">
                <div>11111</div>
            </div>
            <div class="mon-swipe-item">
                <div>2222</div>
            </div>
            <div class="mon-swipe-item">
                <div>3333</div>
            </div>
        </div>
        <div class="mon-dot-wrap" id="mon_dot_ctx">
            <div class="mon-dot"><span class="mon-activeswiper"></span></div>
            <div class="mon-dot"><span class=""></span></div>
            <div class="mon-dot"><span class=""></span></div>
        </div>
    </div>

<script>
new lightSwiper(document.querySelector('#mon_light_swiper'), {
        continuous: true,
        auto: 3000,
        callback: function (index, el) {
            var dots = document.querySelectorAll('#mon_dot_ctx .mon-dot')
            for (var i = 0; i < dots.length; i++) {
                (function (i) {
                    var dot = dots[i].querySelector('span')
                    if (i == index) {
                        dot.className = 'mon-activeswiper'
                    } else dot.className = ''
                })(i)
            }
        }
    });
</script>
</body>
</html>
